/*****************************************************************************
 * $Workfile:: serial.h                                                      $
 * $Revision:: 14                                                            $
 * $JustDate::  3/21/12                                                      $
 *
 *      GENIE V ECU
 *      serial communication interface
 *
 *****************************************************************************/

#ifndef SERIAL_COMM_H
#define SERIAL_COMM_H

#include "common.h"

typedef enum
{
   eBAUD_9600    = 68
   , eBAUD_19200  = 23
   , eBAUD_38400  = 11
   , eBAUD_57600  = 7
   , eBAUD_115200 = 3
} BAUD_e;

typedef enum
{
   eINIT = 0
   , ePROT_A
} xfer_e;

typedef struct
{
   xfer_e eState;
   BAUD_e eBaud;
   UINT8 fSuspectGenVI: 1;
   UINT8 fLockOption: 1;
   UINT8 fLinkActive: 1;
   UINT8 fPlatformInit: 1;
   UINT8 fLostCommunication: 1;
   UINT8 fGpsLostCommunication: 1;
} xfer_t;



/*
 * Global Function Prototypes
 */
extern xfer_t xfer;
extern void serial(void);
extern void serial_init(void);
extern void INT_serial_send(void);
extern void INT_serial_receive(void);
extern UINT8 PROTB_copy(UINT8 bLen,  UINT8 * pbData);
extern UINT8 PROTB_ready(void);

#endif /* SERIAL_COMM_H*/
